package com.story.api.config;

import com.story.api.config.properties.UpyunProperties;
import main.java.com.UpYun;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author Administrator
 * @decription
 * @Date 2017-12-27 11:31
 */
@Configuration
public class UpyunConfig {

    @Autowired
    private UpyunProperties upyunProperties;

    @Bean
    public UpYun upYun() {
        UpYun upyun = new UpYun(upyunProperties.getServerName(), upyunProperties.getUserName(), upyunProperties.getPassword());
        upyun.setDebug(true);
        upyun.setApiDomain(UpYun.ED_AUTO);
        upyun.setTimeout(upyunProperties.getExpireTime());
        return upyun;
    }
}
